﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace company_present
{
    public partial class Delete : ModuleCompanyBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HasPermission())
            {

                if (Request["newsid"] != null)
                {
                    int newsid;
                    if (int.TryParse(Request["newsid"], out newsid))
                    {
                        //kiem tra request["key"] == null thi xoa khoi he thong
                        //truong hop con lai xoa khoi tab do

                        var news = from n in DB.cp_News
                                   where n.ID == newsid
                                   select n;

                        DB.cp_News.DeleteAllOnSubmit(news);
                        DB.SubmitChanges();
                        
                    }
                }

            }
        }

        public bool HasPermission()
        {

            return true;
        }
    }
}